{% extends 'base.html' %}

{% load i18n %}
{% load humanize %}

{% block title %} Search {% endblock %}

{% block head %}
  <link href="{{ STATIC_URL }}css/search.css" rel="stylesheet">
  <script src="{{ STATIC_URL }}js/search.js"></script>
{% endblock head %}

{% block main %}
  <div class="page-header">
    <div class="row">
      <div class="col-md-3">
        <h1>{% trans 'Search' %}</h1>
      </div>
      <div class="col-md-9">
        <form role="search" action="{% url 'search' %}">
          <input type="hidden" name="type" value="{{ active }}">
          <div class="input-group">
            <input type="text" class="form-control" name="q" placeholder="{% trans 'Search Feed, Articles, Questions and Users' %}" value="{{ querystring }}">
            <span class="input-group-btn">
              <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
            </span>
          </div>
        </form>
      </div>
    </div>
  </div>
  <div class="row results">
    <div class="col-md-3">
      {% include 'search/partial_results_menu.html' with active=active count=count querystring=querystring %}
    </div>
    <div class="col-md-9">
      {% if active == 'feed' %}
        {% include 'search/partial_feed_results.html' with results=results %}
      {% elif active == 'articles' %}
        {% include 'search/partial_articles_results.html' with results=results %}
      {% elif active == 'questions' %}
        {% include 'search/partial_questions_results.html' with results=results %}
      {% elif active == 'users' %}
        {% include 'search/partial_users_results.html' with results=results %}
      {% endif %}
    </div>
  </div>
{% endblock main %}